<?php

namespace search\controllers\platform;


use business\elasticsearch\services\NewsService;

class NewsController extends BaseController
{

    public function actionIndex()
    {
        try {
            $page     = (int)$this->getParam('page', 'get', '1');
            $page_size = (int)$this->getParam('page_size', 'get', '10');
            $keyword  = $this->getParam('keyword');
            $category_id  = $this->getParam('category_id');

            $data = (new NewsService())->getList($keyword, $category_id, $page, $page_size);
        } catch (\Exception $ex){
            \Yii::error($ex->getMessage());
            return $this->error('', '获取失败，请稍后重试');
        }

    }

}